//常量

// 在es5中，如何定义一个常量呢？

// Object.defineProperty()

Object.defineProperty(window,'PI',{
    value:3.1415926,
    writable:false
})
// console.log(PI);//3.1415926

// PI=3.1415

// console.log(PI);//writable:true  3.1415
                //writable:false  3.1415926  

//ES6 中使用const声明变量 

// const PI=3.1415
// PI=3.14   
// console.log(PI);//Uncaught Error: "PI" is read-only

const OBJ={
    name:"张三",
    age:20
}

console.log(OBJ);//{name:"张三",age:20}
OBJ.age=30
console.log(OBJ);//{name:"张三",age:30}
OBJ={
    name:"lll",
    age:"2222",
    xb:"男"
}
console.log(OBJ);//Uncaught Error: "OBJ" is read-only
